using System.Collections.Generic;
using System.Threading.Tasks;

namespace AvalonAdmin.BaseViewModel
{
    /// <summary>
    /// CRUD操作视图模型接口
    /// </summary>
    /// <typeparam name="T">数据类型</typeparam>
    public interface ICrudViewModel<T>
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="obj">对象</param>
        /// <returns></returns>
        Task AddAsync(T? obj = default);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="obj">对象</param>
        /// <returns></returns>
        Task UpdateAsync(T? obj = default);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="obj">对象</param>
        /// <returns></returns>
        Task DeleteAsync(T? obj = default);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="items">要删除的项目</param>
        /// <returns></returns>
        Task BatchDeleteAsync(IEnumerable<T>? items = null);
    }
}